from django.conf.urls.defaults import *
from piston.resource import Resource
from account.handlers import LoginHandler
from account.handlers import RegisterHandler
from account.handlers import ProfileImageHandler
from account.handlers import ProfileSearchHandler
from account.handlers import ProfileHandler

class CsrfExemptResource( Resource ):
    def __init__( self, handler, authentication = None ):
        super( CsrfExemptResource, self ).__init__( handler, authentication )
        self.csrf_exempt = getattr( self.handler, 'csrf_exempt', True )

login_resource = CsrfExemptResource( LoginHandler )
register_resource = CsrfExemptResource( RegisterHandler )
profile_resource = CsrfExemptResource( ProfileHandler )
profile_image_resource = CsrfExemptResource( ProfileImageHandler )
profile_search_resource = CsrfExemptResource( ProfileSearchHandler )

urlpatterns = patterns( '',
    url( r'^login/(?P<querystring>.*)$', login_resource ),
    url( r'^register/(?P<querystring>.*)$', register_resource ),
    url( r'^update_profile/(?P<querystring>.*)$', profile_resource ),
	url( r'^update_profile_image/(?P<querystring>.*)$', profile_image_resource ),
	url( r'^search/(?P<querystring>.*)$', profile_search_resource )
)